package com.project.controller;

import com.project.bean.SellCarBean;
import com.project.mapper.ISellCarMapper;
import com.project.service.ISellCarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("sellCar")
public class SellCarController {
    @Autowired
    private ISellCarService sellCarService;

    @RequestMapping("fidById")
   public List<SellCarBean> fidById(Integer userId){
       return sellCarService.fidById(userId);
   }
    @RequestMapping("add")
    public String add(String productId, Integer userId){
        sellCarService.add(productId,userId);
       return"ok";
    }
    @RequestMapping("remove")
    public String remove(Integer carId){
        sellCarService.remove(carId);
        return"ok";
    }

    @RequestMapping("updateNum")
    public String updateNum(Integer carId,Integer num){
       sellCarService.updateNum(carId,num);
        return"ok";
    }

    @RequestMapping("getTotalPrice")
    public Integer getTotalPrice(Integer userId){
        return sellCarService.getTotalPrice(userId);

    }

}
